﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Schedule._Deal._NewDeal
{
    /// <summary>
    /// Interaction logic for SelectSchedule.xaml
    /// </summary>
    public partial class SelectSchedule : Page
    {
        public SelectSchedule()
        {
            InitializeComponent();
            Loaded += NewDeal_Loaded;
            Unloaded += NewDeal_Unloaded;
        }

        void NewDeal_Unloaded(object sender, RoutedEventArgs e)
        {
            (DataContext as Bussiness.Schedule.Schedule).StopRefresh();
        }

        void NewDeal_Loaded(object sender, RoutedEventArgs e)
        {
            (DataContext as Bussiness.Schedule.Schedule).StartRefresh();
            (DataContext as Bussiness.Schedule.Schedule).DealDeskRefresh();
        }
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            (DataContext as Bussiness.Schedule.Schedule).ClearScheduleOrdering();
        }

        private void SelectDesk(object sender, RoutedEventArgs e)
        {
            Deal.pagNewDeal.pagContentFrameSource = NewDeal.pagSelectDesk;
            (DataContext as Bussiness.Schedule.Schedule).StopRefresh();
            (DataContext as Bussiness.Schedule.Schedule).DealDeskRefresh();
        }
    }
}
